from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *


def display():
    gluOrtho2D(-250, 250, -250, 250)
    glViewport(0, 0, 500, 500)
    glClearColor(0, 0, 0, 1)
    glClear(GL_COLOR_BUFFER_BIT)
    glMatrixMode(GL_MODELVIEW)
    glPushMatrix()
    glutWireSphere(50, 30, 30)
    glPopMatrix()
    glPushMatrix()
    glTranslatef(0, 100, 0);
    glutWireSphere(50, 30, 30)  # void glutWireSphere(GLdouble radius, GLint slices, GLint stacks);（半径，经线，纬线）
    glPopMatrix()
    glTranslatef(100, 0, 0)
    glutWireSphere(50, 30, 30)
    glutSwapBuffers()


if __name__ == '__main__':
    glutInit()
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB)
    glutInitWindowSize(500, 500)
    glutCreateWindow("双圆绘制".encode("GBK"))
    glutDisplayFunc(display)
    glutMainLoop()
